<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 14-6-23
 * Time: 下午5:47
 */
require 'Common.php';

$key = $_POST['key'];
$akey = $_POST['akey'];
$skey = $_POST['skey'];
$sig = $_POST['sig'];
$alias = $_POST['alias'];
$files = $_POST['files'];

if(empty($key) || empty($akey) || empty($skey) || empty($sig) || empty($files))
{
    throw new Exception("",'REMOTE_KEY');
}

$config_key = C('UPLOAD')['REMOTE_KEY'];
if($akey!=$config_key){
    throw new Exception("",'invalid_request_key');
}

/*$key = params_deal(SITE_URL);
$secret = get_secret($akey,$skey);
$new_sig = get_signature($key,$secret);
file_put_contents('key.txt',$sig.'--'.$new_sig);
if($sig!=$new_sig){
    throw new Exception("",'invalid_request');
}*/

$del = new Del();
$filesArr = is_array($files) ? $files : explode(',',$files);
$ret = $del->delete(base64_encode($alias),false,$filesArr);
exit(json_encode($ret));
